Skip to content

🐛 fix(provider): load each project's own copy - #5

Merged
gaborbernat merged 1 commit into
mainfrom
scoped-provider-loading
Nov 8, 2026
Merged

gaborbernat merged 1 commit into
mainfrom
scoped-provider-loading

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Adopting python-sbom in virtualenv broke 8 of its SBOM tests on 0.1.1. They build several copies of the project in one process, and each copy's tasks.sbom_content provider was refused because the process had already imported that module from the previous copy. That refusal came from #2's fix for the case where a second project silently ran the first project's provider. The fix was right to stop the silent reuse, but refusing was too strict: a test suite, or any tool driving several hatch builds in one process, is a legitimate user. 🐛

Loading is now scoped to the project instead. When the project provides a module that the import cache holds from somewhere else, the outermost such module is dropped with its submodules before the import, so the project's own copy loads. A provider built earlier keeps the module objects it already references, so its build is unaffected. With this branch installed, virtualenv's SBOM tests pass.

The git calls that read the source revision now decode output as UTF-8 explicitly, which silences the EncodingWarning that PYTHONWARNDEFAULTENCODING surfaced in virtualenv's sdist check.

0.1.1 refused a provider module the process had imported from another project,
which breaks a test suite that builds copies of one project, as virtualenv's
does. The cached module and its submodules are now dropped so the project's own
copy loads; a provider built earlier keeps the modules it references. git output
is decoded as UTF-8 explicitly.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 8, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 python-sbom | 🛠️ Build #35736536 | 📁 Comparing 5d1d34f against latest (0880f77)

  🔍 Preview build  

1 file changed
± changelog.html

@gaborbernat
gaborbernat merged commit 447b84f into main Nov 8, 2026
25 checks passed
@gaborbernat
gaborbernat deleted the scoped-provider-loading branch November 8, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant